package org.veridiandynamics.server.domain;

import java.io.IOException;
import java.io.ObjectInputStream;
import java.io.ObjectOutputStream;
import java.io.Serializable;
import java.util.Date;
import java.util.Map;

/**
 * TreatmentRecord for a particular patient; stores information.
 *
 */
public class TreatmentRecord implements PersistObject, Serializable
{
	private Nurse attendingNurse;
	private DoctorsOrders doctorsOrders;
	
	private String mySymptoms;
	private String myDiagnosis;
	private Date treatmentDate;
	private long id;
	private String bloodPressure;
	private int pulse;
	private int temperature;
	private String height;
	private int weight;
	
	private static final long serialVersionUID = 110L;
	
	/**
	 * Constructor with all applicable information.
	 * 
	 * @param nurse
	 * @param orders
	 * @param symptoms
	 * @param vitalSigns
	 * @param diagnosis
	 * @param patient
	 * @param treatmentDate
	 */
	public TreatmentRecord(Nurse nurse, DoctorsOrders orders, String symptoms,
			Map<String, String> vitalSigns, String diagnosis, Patient patient,
			Date treatmentDate)
	{
		this.attendingNurse = nurse;
		this.doctorsOrders = orders;
		this.mySymptoms = symptoms;
		
		this.bloodPressure = vitalSigns.get("bloodPressure");
		this.pulse = Integer.parseInt(vitalSigns.get("pulse"));
		this.temperature = Integer.parseInt(vitalSigns.get("temperature"));
		this.height = vitalSigns.get("height");
		this.weight = Integer.parseInt(vitalSigns.get("weight"));

		this.myDiagnosis = diagnosis;
		this.treatmentDate = treatmentDate;
	}
	
	/**
	 * Default constructor.
	 */
	public TreatmentRecord()
	{
		
	}
	
	/**
	 * Returns Nurse object 
	 * @return
	 */
	public Nurse getAttendingNurse() {
		return attendingNurse;
	}

	/**
	 * Sets Nurse object
	 * @param attendingNurse
	 */
	public void setAttendingNurse(Nurse attendingNurse) {
		this.attendingNurse = attendingNurse;
	}

	/**
	 * Returns DoctorsOrders for a particular treatment 
	 * @return
	 */
	public DoctorsOrders getDoctorsOrders() {
		return doctorsOrders;
	}

	/**
	 * Sets DoctorsOrders
	 * @param doctorsOrders
	 */
	public void setDoctorsOrders(DoctorsOrders doctorsOrders) {
		this.doctorsOrders = doctorsOrders;
	}

	/**
	 * Returns symptoms for patient.
	 * 
	 * @return
	 */
	public String getMySymptoms() {
		return mySymptoms;
	}

	/**
	 * Sets symptoms for patient.
	 * @param mySymptoms
	 */
	public void setMySymptoms(String mySymptoms) {
		this.mySymptoms = mySymptoms;
	}

	/**
	 * Returns ID for object
	 * @return type long 
	 */
	public long getId() {
		return id;
	}

	/**
	 * Sets ID for object
	 * @param id
	 */
	public void setId(long id) {
		this.id = id;
	}

	/**
	 * Returns blood pressure.
	 * @return
	 */
	public String getBloodPressure() {
		return bloodPressure;
	}

	/**
	 * Sets blood pressure.
	 * @param bloodPressure
	 */
	public void setBloodPressure(String bloodPressure) {
		this.bloodPressure = bloodPressure;
	}

	/**
	 * Returns pulse.
	 * @return
	 */
	public int getPulse() {
		return pulse;
	}

	/**
	 * Sets pulse.
	 * @param pulse
	 */
	public void setPulse(int pulse) {
		this.pulse = pulse;
	}

	/**
	 * Returns temperature.
	 * @return
	 */
	public int getTemperature() {
		return temperature;
	}

	/**
	 * Sets temperature.
	 * @param temperature
	 */
	public void setTemperature(int temperature) {
		this.temperature = temperature;
	}

	/**
	 * Returns height
	 * @return
	 */
	public String getHeight() {
		return height;
	}

	/**
	 * Sets height.
	 * @param height
	 */
	public void setHeight(String height) {
		this.height = height;
	}

	/**
	 * Returns weight.
	 * @return
	 */
	public int getWeight() {
		return weight;
	}

	/**
	 * Sets weight.
	 * @param weight
	 */
	public void setWeight(int weight) {
		this.weight = weight;
	}

	/**
	 * Returns diagnosis.
	 * @return
	 */
	public String getMyDiagnosis() {
		return myDiagnosis;
	}

	/**
	 * Sets diagnosis.
	 * @param myDiagnosis
	 */
	public void setMyDiagnosis(String myDiagnosis) {
		this.myDiagnosis = myDiagnosis;
	}
	
	/**
	 * Returns treatment date.
	 * @return
	 */
	public Date getTreatmentDate() {
		return treatmentDate;
	}
	
	/**
	 * Sets treatment date.
	 * @param treatmentDate
	 */
	public void setTreatmentDate(Date treatmentDate) {
		this.treatmentDate = treatmentDate;
	}
	
	/* (non-Javadoc)
	 * @see java.lang.Object#toString()
	 */
	public String toString()
	{
		String retVal = "";
		retVal += "Attending Nurse: " + attendingNurse.getName() 
		+ "\n" + "Doctor's Orders: \n" + doctorsOrders.toString() + "\n";
		retVal += "Symptoms: \n" + mySymptoms + "\n";
		retVal += "Vital Signs: \n" + "Blood Pressure: " + bloodPressure + "\n";
		retVal += "Pulse: " + pulse + "\n";
		retVal += "Temperature: " + temperature + "\n";
		retVal += "Height: " + height + "\n";
		retVal += "Weight: " + weight + "\n";
		retVal += "Diagnosis: " + myDiagnosis;
		return retVal;
	}
	

	
	/**
	 * Writes object.
	 * 
	 * @param outputStream
	 * @throws IOException
	 */
	private void writeObject(ObjectOutputStream outputStream) throws IOException {
		outputStream.defaultWriteObject();
	}
	
	/**
	 * Reads object.
	 * 
	 * @param inputStream
	 * @throws ClassNotFoundException
	 * @throws IOException
	 */
	private void readObject(ObjectInputStream inputStream) throws ClassNotFoundException, IOException {
		inputStream.defaultReadObject();
	}
}
